package com.lvmama.controller.rhino.visitors;

import com.lvmama.client.rhino.VisitorClient;
import com.lvmama.common.result.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.Map;

@Controller
@RequestMapping("/visitors")
public class VisitorsController {

    /**
     *
     */
    @Autowired
    VisitorClient visitorClient;



    @RequestMapping(value = "/visitorsAnalysis",method = RequestMethod.GET)
    public String visitorsAnalysis(ModelMap model) {
        return "rhino/visitors/visitorsAnalysis";
    }


    @RequestMapping(value = "/visitorChartData",method = RequestMethod.POST)
    @ResponseBody
    public Result<Map<String, Object>> visitorChartData(String chooseTime, String type) {
        return visitorClient.visitorChartData(chooseTime,type);
    }


    @RequestMapping(value = "/visitorPlatformData",method = RequestMethod.POST)
    @ResponseBody
    public Result<Map<String, Object>> visitorPlatformData(String chooseTime, String type, String platform) {
        return visitorClient.visitorPlatformData(chooseTime,type,platform);
    }


    @RequestMapping(value = "/visitorChannelData",method = RequestMethod.POST)
    @ResponseBody
    public Result<Map<String, Object>> getChanenlData(String channelJson) {
        return visitorClient.getChanenlData(channelJson);
    }



}
